package cn.chencaiju.algorithm;

public class BitCharacters {
	public static void main(String[] args) {
		int[] bits= {1,0,1,1,1,1,1,0};
		System.out.println(isZero(bits));
	}
	public static boolean isZero(int[] bits) {
        int end=bits.length;
        if(end==1)
            return true;
		if(bits[end-2]==0)
			return true;
		int count=1;
		for(int i=end-3;i>-1;i--) {
			if(bits[i]==1) {
				count++;
			}else {
				return count%2==0;
			}
		}
		return count%2==0;
	}
}
